(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
    ["pages/login"], {
        3385: function (e, t, n) {
            "use strict";
            n.r(t);
            var o = n("ad93"),
                a = n("df4c");
            for (var s in a)["default"].indexOf(s) < 0 && function (e) {
                n.d(t, e, (function () {
                    return a[e]
                }))
            }(s);
            n("a588");
            var i = n("f0c5"),
                u = Object(i["a"])(a["default"], o["b"], o["c"], !1, null, null, null, !1, o["a"], void 0);
            t["default"] = u.exports
        },
        "38e9": function (e, t, n) {
            "use strict";
            (function (e, t) {
                var o = n("4ea4");
                n("c150"), n("5c17"), n("a9ff");
                o(n("66fd"));
                var a = o(n("3385"));
                e.__webpack_require_UNI_MP_PLUGIN__ = n, t(a.default)
            }).call(this, n("bc2e")["default"], n("543d")["createPage"])
        },
        "7b18": function (e, t, n) {},
        a588: function (e, t, n) {
            "use strict";
            var o = n("7b18"),
                a = n.n(o);
            a.a
        },
        ad93: function (e, t, n) {
            "use strict";
            n.d(t, "b", (function () {
                return o
            })), n.d(t, "c", (function () {
                return a
            })), n.d(t, "a", (function () {}));
            var o = function () {
                    var e = this.$createElement;
                    this._self._c
                },
                a = []
        },
        bde6: function (e, t, n) {
            "use strict";
            (function (e) {
                Object.defineProperty(t, "__esModule", {
                    value: !0
                }), t.default = void 0;
                var n = {
                    data: function () {
                        return {
                            loginState:false,
                            globalData: {
                                userInfo: "",
                            },
                            checked: '',
                            disabled: true,
                            imgSrc: null,
                            url: getApp().globalData.apiurl,
                            loginForm: {
                                username: "",
                                password: "",
                                codeKey: null,
                                codeValue: null
                            },
                            thisCID: null
                        }
                    },
                    methods: {
                        // 使用账号密码登录系统
                        showInputLogin:function(){
                            this.loginState = true
                        },
                        // 登录单击函数
                        getUser: function (e) {
                            let that = this
                            wx.getUserProfile({
                                desc: '正在获取', //不写不弹提示框
                                success: function (res) {
                                    //console.log("登录")
                                    let resInfo = JSON.parse(res.rawData);
                                    //console.log(res.rawData)
                                    wx.setStorageSync('userInfo', resInfo)
                                    that.globalData.userInfo = resInfo
                                    //console.log(that.globalData.userInfo)
                                    let iv = res.iv
                                    let encryptedData = res.encryptedData
                                    wx.login({
                                        success: function (res) {
                                            let code = res.code
                                            wx.request({
                                                url: that.url + 'wxUser/analysisInfo',
                                                method: 'POST',
                                                header: {
                                                    'Content-Type': 'application/json;charset=utf-8',
                                                },
                                                dataType: JSON,
                                                data: {
                                                    encryptedData: encryptedData,
                                                    iv: iv,
                                                    code: code
                                                },
                                                success: function (data) {
                                                    that.setData({
                                                        userInfo: that.globalData.userInfo,
                                                        butChck: true,
                                                        dialog1: true
                                                    })
                                                    wx.hideLoading()
                                                    // console.log(that.globalData.userInfo)
                                                    // console.log(that.data.userInfo)
                                                },
                                                fail: function () {
                                                    //console.log('系统错误')
                                                    wx.showToast({
                                                        title: '失败',
                                                        icon: 'error'
                                                    })
                                                }
                                            })
                                        }
                                    })
                                },
                                fail: function (err) {
                                    // console.log('系统错误')
                                    // console.log(err)
                                    wx.showToast({
                                        title: '失败',
                                        icon: 'error'
                                    })
                                }
                            })
                        },
                        getUserInfo: function () {
                            wx.getUserProfile({
                                desc: '展示用户信息', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
                                success: (res) => {
                                    let resInfo = JSON.parse(res.rawData);
                                    //console.log(res.rawData)
                                    wx.login({
                                        success: function (res) {
                                            //console.log(res)


                                        }
                                    });
                                }
                            })
                        },
                        //获取手机号｜｜模拟登录
                        getPhoneNumber: function (e) {
                            //console.log(e)
                            //console.log("手机号登录")
                            let that = this
                            if (!e.detail.errMsg || e.detail.errMsg !== "getPhoneNumber:ok") {
                                wx.showModal({
                                    title: '提示',
                                    content: e.detail.errMsg,
                                    showCancel: false
                                })
                                return;
                            }
                            let encryptedData = e.detail.encryptedData
                            let iv = e.detail.iv
                            wx.login({
                                success: (res) => {
                                    let code = res.code
                                    wx.request({
                                        url: that.data.url + 'wxUser/app/login',
                                        method: 'POST',
                                        dataType: JSON,
                                        data: {
                                            encryptedData: encryptedData,
                                            iv: iv,
                                            code: code
                                        },
                                        success: function (data) {
                                            //console.log(data)
                                            let res1 = JSON.parse(data.data);
                                            if (res1.code == 5000) {
                                                wx.showToast({
                                                    title: '用户不存在，请联系管理员',
                                                    icon: 'none',
                                                    duration: 3000
                                                })
                                            }
                                            // 解析成功进行模拟登录
                                            if (res1.state == 2000) {
                                                that.setData({
                                                    "loginForm.username": res1.account,
                                                    "loginForm.password": res1.password,
                                                })
                                                that.submitForm()
                                            }
                                        },
                                        fail: function () {
                                            console.log('系统错误')
                                            wx.showToast({
                                                title: '失败',
                                            })
                                        }
                                    })
                                },
                                error: (res) => {
                                    console.log('失败');
                                },
                            })
                        },
                        // 跳转页面 隐私协议
                        agreement: function () {
                            wx.navigateTo({
                                url: "/pages/main/isPrivacy/PrivacyPolicy?showViews=隐私政策"
                            });

                            // wx.navigateTo({
                            //     url: "/pages/main/isPrivacy/PrivacyPolicy.wxml"
                            // })
                        },
                        // 跳转页面 用户协议
                        agreement1: function () {
                            wx.navigateTo({
                                url: "/pages/main/isPrivacy/PrivacyPolicy?showViews=用户协议"
                            });
                        },
                        // 判断复选框选中状态
                        checkboxChange: function (e, i) {

                            if (this.disabled) {
                                this.checked = true;
                                this.disabled = false;
                            } else {
                                this.checked = false;
                                this.disabled = true;
                            }


                            return;
                            let val = e.detail.value
                            if (val.length > 0) {
                                this.setData({
                                    checked: true,
                                    disabled: false
                                })
                            } else {
                                this.setData({
                                    checked: false,
                                    disabled: true
                                })
                            }
                        },
                        handleCIDLogin: function () {
                            var t = this;
                            e.getPushClientId({
                                success: function (e) {
                                    t.thisCID = e.cid
                                },
                                fail: function (e) {
                                    //ƒconsole.log(e)
                                },
                                complete: function () {
                                    //console.log("获取当前用户的cid：" + t.thisCID)
                                }
                            })
                        },
                        insertCID: function () {
                            //console.log("执行添加用户信息函数", this.thisCID), 
                            null != this.thisCID && e.request({
                                url: this.url + "appLoginRedis/setAccountInfo",
                                method: "GET",
                                data: {
                                    equipmentCID: this.thisCID,
                                    accountNumber: this.loginForm.username,
                                    accountPassword: this.loginForm.password
                                },
                                success: function (e) {
                                    //console.log(e)
                                }
                            })
                        },
                        selectCID: function (t) {
                            var n = this;
                            //console.log(t), 
                            e.request({
                                url: this.url + "appLoginRedis/getAccountInfo",
                                method: "GET",
                                data: {
                                    equipmentCID: t
                                },
                                success: function (e) {
                                    var t = e.data;
                                    // console.log("调用后台redis"), console.log(e.data.stateApp), 
                                    if (void 0 != t.stateApp) return "首次登录";
                                    n.loginForm.username = t.accountNumber, n.loginForm.password = t.accountPassword, n.submitForm(), console.log("模拟登录！")
                                }
                            })
                        },
                        verification: function () {
                            // console.log("校验")
                            e.showToast({
                                title: "请阅读下方政策",
                                icon: "error"
                            });

                        },
                        submitForm: function () {
                            var t = this,
                                n = getApp().globalData.userinfo;
                            if (void 0 == n.userName || "" == n.userName) {
                                var o = this.loginForm;
                                if (!o.username) return void e.showToast({
                                    title: "请输入帐号",
                                    icon: "error"
                                });
                                if (!o.password) return void e.showToast({
                                    title: "请输入密码",
                                    icon: "error"
                                });
                                e.request({
                                    url: this.url + "login",
                                    method: "POST",
                                    data: {
                                        username: o.username,
                                        password: o.password
                                    },
                                    success: function (n) {
                                        var a = o.username;
                                        null != n.data.token ? e.request({
                                            url: t.url + "apiunattended/apiunattended/getUserInfo",
                                            method: "GET",
                                            data: {
                                                username: a
                                            },
                                            success: function (t) {
                                                getApp().globalData.userinfo = t.data;
                                                e.getStorageSync("key");
                                                e.switchTab({
                                                    url: "/pages/main/index?users=".concat(a)
                                                })
                                            },
                                            fail: function () {},
                                            complete: function () {
                                                e.getPushClientId({
                                                    success: function (t) {
                                                        var n = t.cid;
                                                        e.request({
                                                            url: getApp().globalData.apiurl + "zrwjMessage/setCID",
                                                            method: "GET",
                                                            data: {
                                                                userKEY: getApp().globalData.userinfo.nickName,
                                                                messCID: n
                                                            }
                                                        })
                                                    },
                                                    fail: function (e) {
                                                        //console.log(e)
                                                    }
                                                })
                                            }
                                        }) : e.showToast({
                                            title: "用户名或密码错误！",
                                            icon: "error"
                                        })
                                    },
                                    fail: function () {},
                                    complete: function () {
                                        //console.log("添加redis"), 
                                        t.insertCID()
                                    }
                                })
                            } else e.switchTab({
                                url: "/pages/main/index"
                            })
                        }
                    },
                    onLoad: function (e) {
                        this.handleCIDLogin()
                    }
                };
                t.default = n
            }).call(this, n("543d")["default"])
        },
        df4c: function (e, t, n) {
            "use strict";
            n.r(t);
            var o = n("bde6"),
                a = n.n(o);
            for (var s in o)["default"].indexOf(s) < 0 && function (e) {
                n.d(t, e, (function () {
                    return o[e]
                }))
            }(s);
            t["default"] = a.a
        }
    },
    [
        ["38e9", "common/runtime", "common/vendor"]
    ]
]);